import type { BasicColumn, FormSchema } from '@/components/Table'
import { useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'

export const columns: BasicColumn[] = [
  {
    title: 'id',
    dataIndex: 'id',
    width: 180,
    ifShow: false,
  },
  {
    title: '导入状态',
    dataIndex: 'state',
    width: 180,
    customRender: ({ text }) => {
      return useRender.renderDict(text, DICT_TYPE.IMPORT_STATE)
    },
  },
  {
    title: '县区',
    dataIndex: 'deptName',
    width: 160,
  },
  {
    title: '创建者',
    dataIndex: 'createName',
    width: 160,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
    customRender: ({ text }) => {
      return useRender.renderDate(text)
    },
  },
  {
    title: '更新者',
    dataIndex: 'updateName',
    width: 160,
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    width: 180,
    customRender: ({ text }) => {
      return useRender.renderDate(text)
    },
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    label: '导入状态',
    field: 'state',
    component: 'Select',
    componentProps: {
      options: getDictOptions(DICT_TYPE.IMPORT_STATE, 'string'),
    },
    colProps: { span: 8 },
  },
  {
    label: '创建者',
    field: 'creator',
    component: 'Input',
    ifShow: false,
    colProps: { span: 8 },
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'RangePicker',
    colProps: { span: 8 },
  },
  {
    label: '更新者',
    field: 'updater',
    ifShow: false,
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    label: '更新时间',
    field: 'updateTime',
    component: 'RangePicker',
    colProps: { span: 8 },
  },
]

export const createFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input',
  },
]

export const updateFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input',
  },
]
